package org.jeecg.config;

import com.baidu.aip.ocr.AipOcr;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BaiduAipClient {

    //设置APPID/AK/SK
    @Value("${api.baidu.com.appid:25955584}")
    private String APP_ID;
    @Value("${api.baidu.com.appkey:nXB9Hkf9dFP9dkltXvYbcZm0}")
    private String API_KEY;
    @Value("${api.baidu.com.appsecret:4GtegpFsWG5XCR4lQxhG3VhSF1XGeuSm}")
    private String SECRET_KEY;

    @Bean
    public AipOcr createAipOcr(){

        AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);

        //建立连接的超时时间（单位：毫秒）
        client.setConnectionTimeoutInMillis(2000);

        //通过打开的连接传输数据的超时时间（单位：毫秒）
        client.setSocketTimeoutInMillis(60000);

        return client;

    }

}
